package com.wx.testwxlogin.controller;

import com.wx.service.WxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sun.awt.windows.WPrinterJob;

@Controller
public class WxController {

    @Autowired
    private WxService wxService;


    /**
     * 微信登录
     * @return
     */
    @RequestMapping(value = "wx/login")
    public String wxLogin(){
        String temp="redirect:".concat(wxService.getWxLoginUrl());
        return temp;
    }

    @RequestMapping(value = "wx/test")
    public String test(){
        System.out.println("aaaa");
        return "hello World";
    }

    /**
     * 微信回调
     * @param code
     * @param state
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "callback/otherlogin/wxlogin")
    public String wxCallbackLogin(String code,String state){
        return code;
    }

}
